package com.bt.bodyscale.activitys;

import android.support.v4.view.ViewPager;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.bt.bodyscale.R;
import com.ebelter.btcomlib.bases.activity.BaseActivity;
import com.ebelter.btcomlib.utils.KeyBoardShowListener;
import com.ebelter.btcomlib.utils.ViewUtils;
import com.ebelter.btcomlib.utils.log.LogUtils;
import butterknife.BindView;
import butterknife.OnClick;

/**
 * 注册Activity，包含用户信息录入，账号密码设置
 */

public class RegisterActivity extends BaseActivity {

    private static final String TAG = "RegisterActivity";


    @BindView(R.id.iv_back_register)
    ImageView iv_back_register;

    @BindView(R.id.vp_register)
    ViewPager vpRegister;

    @BindView(R.id.btn_next_register)
    TextView btn_next_register;



    private int curIndex;
    private int mHeight = 176;
    private int mSex = 0;//0男1女



    @Override
    protected int loadLayoutById() {
        return R.layout.activity_register;
    }

    KeyBoardShowListener keyBoardShowListener = new KeyBoardShowListener(this);
    @Override
    protected void initView() {

    //监听软键盘的状态
        keyBoardShowListener.setKeyboardListener(

                new KeyBoardShowListener.OnKeyboardVisibilityListener() {
                    @Override
                    public void onVisibilityChanged(boolean visible) {
                        if (visible) {
                            //软键盘已弹出
                            LogUtils.e(TAG,"----------软键盘已弹出");
                            ViewUtils.hideView(btn_next_register);

                        } else {
                            //软键盘未弹出
                            LogUtils.e(TAG,"----------软键盘未弹出");
                            ViewUtils.displayView(btn_next_register);
                        }
                    }
                }, RegisterActivity.this);


    }
    @Override
    protected void initData() {



        //vpRegister.setAdapter(new RegisterPagerAdapter(pagers));
       // vpRegister.setOffscreenPageLimit(pagers.size());
       // vpRegister.addOnPageChangeListener(this);
    }

    private void setNextBtText(int curIndex) {
        btn_next_register.setText(curIndex < 3 ? getString(R.string.next) : getString(R.string.done));
    }


    //设置下一步按钮是否可以用
    public void setbtn_next_register(boolean enable){
        btn_next_register.setEnabled(enable);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(keyCode == KeyEvent.KEYCODE_BACK) { //屏蔽返回键
            btClick(iv_back_register);
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    @OnClick({R.id.iv_back_register, R.id.btn_next_register})
    public void btClick(View view) {

    }



    private void doneBtClick() {


    }






}
